Skip to content

ref(openai): Separate output handling#5543

Merged
alexander-alderman-webb merged 4 commits intomasterfrom
webb/openai/separate-output-handling-by-api
Mar 2, 2026
Merged

ref(openai): Separate output handling#5543
alexander-alderman-webb merged 4 commits intomasterfrom
webb/openai/separate-output-handling-by-api

Conversation

@alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Feb 26, 2026

Description

Create separate functions for output-handling of openai Responses, Completions, and Embedding API functions. Create streaming variants where applicable.

Issues

Reminders

@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Add set_attribute, remove_attribute to global API by sentrivana in #5555

Bug Fixes 🐛

Openai

  • Avoid consuming iterables passed to the Completions API by alexander-alderman-webb in #5489
  • Avoid consuming iterables passed to the Embeddings API by alexander-alderman-webb in #5491

Other

  • (anthropic) Fix token accounting by shellmayr in #5490
  • (google-genai) Remove agent spans for simple requests by alexander-alderman-webb in #5443
  • (grpc) Read method from handler_call_details for grpcio >= 1.76 compat by yeung108 in #5521
  • (httpx) Correctly append baggage in async client by sentrivana in #5530
  • (pydantic-ai) Adapt to missing ToolManager._call_tool by sentrivana in #5522
  • (utils) Use HEROKU_BUILD_COMMIT env var for default release by ericapisani in #5499
  • (wsgi) Do not wrap file responses when uWSGI offload-threads is enabled by ericapisani in #5556

Documentation 📚

  • Add troubleshooting note for editable installs with uWSGI by ericapisani in #5552
  • Add debugging advice by alexander-alderman-webb in #5517
  • New integration guide by alexander-alderman-webb in #5476

Internal Changes 🔧

Agents

  • Add security-review skill to agent configuration by ericapisani in #5498
  • Add sentry skills to be used by warden in CI reviews by ericapisani in #5485

Openai Agents

  • Remove set_data_normalized for primitive attributes by alexander-alderman-webb in #5509
  • Expect new tool fields by alexander-alderman-webb in #5471

Other

  • (ai) Add configuration for dotagents by ericapisani in #5480
  • (anthropic) Remove set_data_normalized for primitive attributes by alexander-alderman-webb in #5504
  • (github) Add warden configuration by ericapisani in #5484
  • (openai) Separate output handling by alexander-alderman-webb in #5543
  • (pydantic-ai) Remove set_data_normalized for the gen_ai.response.model attribute by alexander-alderman-webb in #5512
  • (repo) Add .serena to .gitignore by ericapisani in #5464
  • Updated codecov.yml by MathurAditya724 in #5571
  • 🤖 Update test matrix with new releases (02/24) by github-actions in #5524
  • 🤖 Update test matrix with new releases (02/23) by github-actions in #5503
  • 🤖 Update test matrix with new releases (02/19) by github-actions in #5483
  • 🤖 Update test matrix with new releases (02/18) by github-actions in #5475

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 7.88s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 13749 uncovered lines.
✅ Project coverage is 30.75%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
openai.py 5.23% ⚠️ 526 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    25.65%    30.75%     +5.1%
==========================================
  Files          189       189         —
  Lines        19838     19854       +16
  Branches      6430      6434        +4
==========================================
+ Hits          5089      6105     +1016
- Misses       14749     13749     -1000
- Partials       421       468       +47

Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review February 26, 2026 15:25
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner February 26, 2026 15:25
Copy link
Member

@ericapisani ericapisani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of naming things but otherwise LGTM.

kwargs: "dict[str, Any]",
integration: "OpenAIIntegration",
start_time: "Optional[float]" = None,
finish_span: bool = True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I can see there being a possibility that the name finish_span could be interpreted as the "ending span" (a noun) rather than "mark the span as finished" (a verb/action).

If it's not a massive pain, it might be worth renaming to mark_span_as_finished

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good point, naming is hard 😅
I'll follow up later with readability changes to keep this PR atomic



def _set_output_data(
def _common_set_output_data(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: _set_common_output_data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed 63acf10

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@alexander-alderman-webb alexander-alderman-webb merged commit 6837662 into master Mar 2, 2026
160 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/openai/separate-output-handling-by-api branch March 2, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants